package com.example.arithmeticleetcode.leetcode.nov;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-11-19 10:30
 **/
public class Demo12 {

    public static void main(String[] args) {
        System.out.println(numOfBurgers(16, 7));
        System.out.println(numOfBurgers(17, 4));
        System.out.println(numOfBurgers(4, 17));
        System.out.println(numOfBurgers(0, 0));
        System.out.println(numOfBurgers(2, 1));
        System.out.println(numOfBurgers(2385088, 164763));
    }

    public static List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {
        List<Integer> list = new ArrayList<>();
        if (tomatoSlices < (cheeseSlices << 1)) {
            return list;
        }
        int totalJumbo = 0;
        int totalSmall = 0;
        totalJumbo = (tomatoSlices - (cheeseSlices << 1)) >> 1;
        totalSmall = cheeseSlices - totalJumbo;
        if (((totalJumbo << 2) + Math.abs(totalSmall << 1)) == tomatoSlices) {
            list.add(totalJumbo);
            list.add(totalSmall);
        }
        return list;

    }
}
